package org.java.commons.vo;

import lombok.Getter;
import lombok.Setter;

// vo : value object，用于在各个层之间传递数据，这些数据不会保存到数据库。
@Getter
@Setter
public class Result {
    private int code;
    private String message;

    public static Result ok(String message) {
        return build(1, message);
    }


    public static Result error(String message) {
        return build(2, message);
    }

    private static Result build(int code, String message) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }
}